package com.qf.controller.utils;

import org.apache.curator.RetryPolicy;
import org.apache.curator.framework.CuratorFramework;
import org.apache.curator.framework.CuratorFrameworkFactory;
import org.apache.curator.retry.ExponentialBackoffRetry;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * author:z
 * time:2021/12/24 11:53
 * description:
 */
@Configuration
public class ZKUtils {


    @Bean
    public  CuratorFramework getClient(){
        RetryPolicy retryPolicy=new ExponentialBackoffRetry(3000,2);
        CuratorFramework client = CuratorFrameworkFactory.builder().connectString("192.168.85.128:2181").retryPolicy(retryPolicy).build();
        client.start();
        return client;
    }
}
